﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    
    public class InboundOrderEntity
    {
        public int warehouse_receipt_id { get; set; } // 自增主键
        public int? warehouse_id { get; set; }
        public int? rule_id { get; set; }
        public int? type_id { get; set; }
        public string warehouse_receipt_no { get; set; } // 入库单号
        public string storage_type { get; set; } // 入库类型
        public string warehouse_name { get; set; } // 仓库名称
        public string storage_status { get; set; } // 入库状态
        public DateTime date_of_storage { get; set; } // 入库日期
        public string associated_order_no { get; set; } // 关联单号（进货单）
        public int suppliers_id { get; set; } // 供应商ID
        public int handler_id { get; set; } // 经办人ID
        public int organizations_id { get; set; } // 组织机构ID
        public string reviewer { get; set; } // 审核人
        public DateTime? review_time { get; set; } // 审核时间
        public string note { get; set; } // 备注
        public string create_by { get; set; } // 创建人
        public DateTime create_time { get; set; } // 创建时间
        public string update_by { get; set; } // 修改人
        public DateTime? update_time { get; set; } // 修改时间
        public string is_delete { get; set; } = "0"; // 是否删除
        public string warehouse_code { get; set; }
    }

    /// <summary>
    /// 入库单明细表实体（假设表名为wms_knzy_stock_in_details）
    /// </summary>
    public class InboundOrderDetailEntity
    {
        public int detail_id { get; set; } // 明细自增ID
        public int warehouse_receipt_id { get; set; } // 关联入库单主表ID
        public string product_code { get; set; } // 货品编号
        public int inbound_quantity { get; set; } // 入库数量
        public int inbound_location { get; set; } // 入库库位
        public string batch_no { get; set; } // 批次号
        public DateTime? production_date { get; set; } // 生产日期
        public string note { get; set; } // 明细备注
    }


    /// <summary>
    /// 入库单明细表实体（对应wms_knzy_warehousing_details）
    /// </summary>
    public class InboundOrderDetailEntity2
    {
        /// <summary>
        /// 明细ID（自增）
        /// </summary>
        public int inbound_detail_id { get; set; }

        /// <summary>
        /// 关联入库单ID
        /// </summary>
        public int warehouse_receipt_id { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        public string product_code { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal unit_price { get; set; }

        /// <summary>
        /// 本次入库数量
        /// </summary>
        public int curr_stk_in_num { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        public string batch_number { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? Production_date { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string note { get; set; }

        /// <summary>
        /// 入库库位
        /// </summary>
        public int storage_location { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string create_by { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime create_time { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string update_by { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? update_time { get; set; }

        /// <summary>
        /// 是否删除（0-未删除）
        /// </summary>
        public string is_delete { get; set; } = "0";
    }

    /// <summary>
    /// 前端入库单请求模型
    /// </summary>
    public class InboundOrderRequest
    {
        
        public string warehouse_receipt_no { get; set; }
        public int? warehouse_id { get; set; }
        public int? rule_id { get; set; }
        public int? type_id { get; set; }
        
        public string storage_type { get; set; }
        public string? warehouse_name { get; set; }
        public string? storage_status { get; set; }
        public string date_of_storage { get; set; }
        public string associated_order_no { get; set; }
        public int suppliers_id { get; set; }
        public int handler_id { get; set; }
        public int organizations_id { get; set; }
        public string note { get; set; }    
        public List<InboundDetailRequest> details { get; set; }
    }

    /// <summary>
    /// 前端入库明细请求模型
    /// </summary>
    public class InboundDetailRequest
    {
        public string product_code { get; set; }
        public int inbound_quantity { get; set; }
        public int inbound_location { get; set; }
        public string batch_no { get; set; }
        public string production_date { get; set; }
        public string note { get; set; }
        public decimal unit_price { get; set; }
    }



    [Table("wms_order_purchase_order")]
    public class PurchaseOrderEntity2
    {
        public int purchase_id { get; set; }
        public int supplier_id { get; set; }
        public int? rule_id { get; set; }
        public string purchase_order_no { get; set; }
        public int suppliers_id { get; set; }
        public DateTime purchase_date { get; set; }
        public string document_status { get; set; }
        public string contact_person { get; set; }
        public string contact_information { get; set; }
        public string purchaser { get; set; }
        public string reviewer { get; set; }
        public DateTime review_time { get; set; }
        public int organizations_id { get; set; }
        public string note { get; set; }
        public string create_by { get; set; }
        public DateTime create_time { get; set; }
        public string update_by { get; set; }
        public DateTime? update_time { get; set; }
        public string is_delete { get; set; }
    }


    [Table("wms_order_details")]
    public class PurchaseOrderDetailEntity
    {
        public int purchase_details_id { get; set; }
        public int purchase_id { get; set; }
        public decimal purchase_unit_price { get; set; }
        public int prod_num { get; set; }
        public int purreturn_num { get; set; }
        public int stkIn_num { get; set; }
        public string note { get; set; }
        public string create_by { get; set; }
        public DateTime create_time { get; set; }
        public string update_by { get; set; }
        public DateTime? update_time { get; set; }
        public string is_delete { get; set; }
    }




    /// <summary>
    /// 入库单审核请求模型
    /// </summary>
    public class AuditRequest
    {
        /// <summary>
        /// 入库单ID
        /// </summary>
        public int WarehouseReceiptId { get; set; }

        /// <summary>
        /// 是否审核通过（true=通过，false=驳回）
        /// </summary>
        public bool IsApproved { get; set; }

        /// <summary>
        /// 审核人（登录用户名）
        /// </summary>
        public string? Reviewer { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        public string Opinion { get; set; }
    }

   
}



